<style type="text/css">
body{background:#eee}
.storelogo img{width:3.2rem;height:3.2rem}
.merchgroup .store-star {padding:0.1rem 0 0.2rem 0;font-size:0.55rem;line-height:1rem}
.merchgroup .store-star img{height:0.66rem}
.star-on,.star-off{position:absolute;top:1rem;left:0;overflow:hidden}
.star-rate {margin-left:3.6rem}
.store-distance{float:right;color:#999}
.store-moneylimit{font-size:0.55rem}
.fui-number .minus:before, .fui-number .plus:before {
	border-left: 0 solid #d9d9d9;
}
.fui-number .minus:after, .fui-number .plus:after {
	border-right: 0 solid #d9d9d9;
}
.fui-number:before {
	border-top: 0 solid #d9d9d9;
}
.fui-number:after {border-top: 0 solid #d9d9d9;}
.fui-number .num {
	color:#666;
}
.fui-number .num {
	color:#666;
}
.fui-number.small {
	height: 1.2rem;
	width: auto;
	line-height: 1.2rem;
}
.fui-number .minus, .fui-number .plus {
	z-index:0;
}
.fui-number.small .minus{
	color: {{main.syscolor || '#63BE72'}};
	padding-top:1px;
	border: 1px solid {{main.syscolor || '#63BE72'}};
	border-radius:50%;
}
 .fui-number.small .plus {
	color: #fff;
	padding-top:1px;
	background: {{main.syscolor || '#63BE72'}};
	border: 1px solid {{main.syscolor || '#63BE72'}};
	border-radius:50%;
}
.fui-btn-c {
    height: auto;
    margin: 0;
    padding: 0.4rem;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
	justify-content:center;
    align-items: center;
    position: relative;
}

.fui-btn-c .icon {
	font-size:1rem;
	padding-right:0.3rem;
	text-align:right;
}

.fui-btn-c .info {
	text-align:left;
    padding-right: 0.2rem;
    font-size: 0.75rem;
}

.fui-btn-c .info p {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}
.jylabel-red-0.active::after{content:" ";width:23px;height:24px;background:url(../core/resource/images/promotion-bg.png) 0 -159px no-repeat;position:absolute;float:right;right:-1px;bottom:-1px;text-align:center;background-color:#fce9e9;}
.sendtype-tip {padding: 0.5rem 0rem; background: #fdf5e9;font-size:0.65rem;padding:0.3rem;}
</style>
<div class="fui-page order-create-page fui-page-current" ng-if="pagedata.op == 'buyguoshu'">
	 <div class="fui-header">
		<div class="fui-header-left" ng-click="goback()">
            <a class="back"></a>
        </div>
		<div class="title">领养果树</div>
		<div class="fui-header-right"></div>
	</div>
	<div class="fui-content">
		<div class="sendtype-tip"><red>水果</red>成熟后，领取<red>水果</red>的方式有两种：1、想要水果，可以设置快递配送水果/上门自提水果；2、不想要水果，到时可以《回收》，将按经济收益打款给您！</div>
		<div class="jy-content">
		<div class="weui_cells" style="margin-top:0.5rem">
		<div class="weui_cell">
                <div class="weui_cell_hd weui_cell_primary" style="padding:0.3rem 0">
                    <span>果树名称</span>
                </div>
                <div class="weui_cell_ft">{{pagedata.animal.title}}</div>
        </div>
		<div class="weui_cell">
                <div class="weui_cell_hd weui_cell_primary"  style="padding:0.3rem 0">
                    <span>果树分类</span>
                </div>
                <div class="weui_cell_ft">{{pagedata.aclassify.title}}</div>
        </div>
		<div class="weui_cell">
                <div class="weui_cell_hd weui_cell_primary"  style="padding:0.3rem 0">
                    <span>成熟周期</span>
                </div>
                <div class="weui_cell_ft">{{pagedata.animal.growtime}}天</div>
        </div>
		<div ng-if="pagedata.animal.shouyue>0" class="weui_cell">
                <div class="weui_cell_hd weui_cell_primary"  style="padding:0.3rem 0">
                    <span>收获月份</span>
                </div>
                <div class="weui_cell_ft">{{pagedata.animal.shouyue}}月</div>
        </div>
		<div class="weui_cell">
                <div class="weui_cell_hd weui_cell_primary"  style="padding:0.3rem 0">
                    <span>预计收益</span>
                </div>
                <div class="weui_cell_ft">{{pagedata.animal.shoukg}}KG / {{pagedata.animal.shoufee}}元</div>
        </div>
		<div class="weui_cell">
                <div class="weui_cell_hd weui_cell_primary"  style="padding:0.3rem 0">
                    <span>单价费用</span>
                </div>
                <div class="weui_cell_ft">{{pagedata.animal.price}}元</div>
        </div>
		<div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">认领数量(棵)</label></div>
                <div class="weui_cell_hd weui_cell_primary">
                    <span class="fui-number small r-f" style="right:0;margin-top:0.3rem">
						<span class="minus" ng-click="pagedata.cart_minus()"><i class="icon icon-subtract" style="font-size:0.7rem"></i></span>
							<input ng-if="pagedata.post.total>0" class="num shownum" type="text" ng-model="pagedata.post.total" style="width:1rem" ng-change="pagedata.cart_refresh()"/>
						<span class="plus" ng-click="pagedata.cart_plus()"><i class="icon icon-tianjia" style="font-size:0.7rem"></i></span>
					</span>
                </div>
        </div>
		<div ng-if="pagedata.animal.minbuy>0" class="weui_cell_title r" style="font-size:0.65rem;padding: 0.5rem 2px;margin-top:-1.2rem;">认领起步数量 {{pagedata.animal.minbuy}} (棵)</div>
		<div ng-if="pagedata.post.sendtype!=1" class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">联系人</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input ng-model="pagedata.post.username" class="weui_input" type="text" placeholder="请输入联系人">
                </div>
        </div>
		<div ng-if="pagedata.post.sendtype!=1" class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">联系电话</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input ng-model="pagedata.post.mobile" class="weui_input" type="text" placeholder="请输入电话">
                </div>
        </div>
		<div class="weui_cell">
			<div class="weui_cell_hd weui_cell_primary"><label class="weui_label">{{pagedata.post.title5}}(优惠券)</label></div>
			<div ng-if="pagedata.coupons.length>0" class="weui_cell_ft" ng-click="pagedata.showcoupon=true;">
			<div ng-if="pagedata.post.backtype!=1" class="bold"><span class='dispatchprice'>-￥{{pagedata.post.deduct}}</span></div>
			<div ng-if="pagedata.post.backtype==1" class="bold"><span class='dispatchprice'>{{pagedata.post.discount}}</span>折</div>
			</div>
			<div ng-if="pagedata.coupons.length<=0" class="weui_cell_ft" ng-click="pagedata.showcoupon=true;">
				<span class='text'>{{pagedata.order.exitnomerch?'无该商户可用优惠券':'无可用'}}</span>
			</div>
		</div>
		</div>
		<div class="weui_btn_area">	
			<div class="fui-cellone small" style="padding-bottom:0.2rem">
				<div class="fui-cellone-info">
					<label class="checkbox-inline">
						<input type="checkbox" value="1" ng-model="pagedata.post.check" class="fui-checkbox-primary" id="agree" ng-checked="pagedata.post.check==1"/> 我已经阅读<a id="btn-apply" ng-click="pagedata.show_xieyi=true;" style="color:#337ab7;">【{{pagedata.aclassify.xieyi_title || '认领协议'}}】</a>。
					</label>
				</div>
			</div>
			 <a ng-if="!pagedata.order_id" class="weui_btn weui_btn_primary" href="javascript:" id="showTooltips" ng-click="pagedata.pay()">确认支付{{pagedata.showprice}}</a>
			 <a ng-if="pagedata.order_id" class="weui_btn weui_btn_primary" href="javascript:" id="showTooltips" ng-click="access_json('jy_newnong/order//type=animal_list')">查看订单</a>
		</div>
		</div>
</div>
</div>
<div ng-if="pagedata.showcoupon" class="popup">
	<div class="popup-body">
		<div class="popup-bottom" style="padding-top:1rem">
			<i class="closed icon icon-cuowu" ng-click="pagedata.showcoupon=false"></i>
			<div ng-include="sys_html('shop/_picker')"></div>
		</div>
	</div>
</div>
<div ng-if="pagedata.show_xieyi" class="popup">
	<div class="popup-body">
		<div class="popup-center">
			<i class="closed icon icon-cuowu" ng-click="pagedata.show_xieyi=false"></i>
			<div class="content-images" style="padding:0.5rem;height:20rem; overflow-y:scroll;">
					<div class="title bold" style="font-size:0.8rem">{{pagedata.aclassify.xieyi_title || '认领协议'}} / <small>Read Ggree</small></div>
					<div class="text" style="padding-top:0.5rem;font-size:0.7rem" ng-bind-html="trust(pagedata.aclassify.xieyi_content)">
					</div>
			</div>
			<div class="modal-footer">
				<div ng-click="pagedata.show_xieyi=false;pagedata.post.check=1;" class="mod-check" style="width: 100%; margin: 0;">我已阅读</div>
			</div>
		</div>
	</div>
</div>
<div ng-include="sys_html('_footer')"></div>
<script type="text/javascript">
//刷新总数和总价
scope.pagedata.cart_refresh=function(){
	scope.pagedata.totalprice=scope.pagedata.animal.price*scope.pagedata.post.total;
	if(scope.pagedata.post.sendtype==1 && scope.pagedata.totalprice){
		scope.pagedata.totalprice +=scope.pagedata.post.peisongfee*1;
	}
	scope.pagedata.showprice=scope.pagedata.totalprice-scope.pagedata.post.coupon_de_price*1;
	scope.pagedata.showprice=scope.price(scope.pagedata.showprice);
	scope.$evalAsync();
}
scope.pagedata.cart_refresh();
//减少
scope.pagedata.cart_minus=function(){
	if(scope.pagedata.post.total<=1){
		return false;
	}
	if(scope.pagedata.animal.minbuy>0 && scope.pagedata.post.total<=scope.pagedata.animal.minbuy){
		scope.message('认领起步数量'+scope.pagedata.animal.minbuy+'棵！','error');
		return false;
	}
	scope.pagedata.post.total--
	scope.pagedata.cart_refresh();
}
//增加
scope.pagedata.cart_plus=function(g){
	scope.pagedata.post.total++
	scope.pagedata.cart_refresh();
}
scope.pagedata.checkcoupon=function(type){
	if(type){
		if(scope.pagedata.post.backtype!=1){
			scope.pagedata.post.coupon_de_price=scope.pagedata.post.deduct
		}else{
			scope.pagedata.post.coupon_de_price = scope.pagedata.totalprice * (10-scope.pagedata.post.discount)/10;		
		}
	}else{
		scope.pagedata.post.couponid=0;
		scope.pagedata.post.coupon_de_price=0
	}
	scope.pagedata.cart_refresh();
	scope.pagedata.showcoupon=false;
	scope.$evalAsync();
}
scope.pagedata.pay=function(){
	if(scope.pagedata.post.check!=1){
		scope.message('请先阅读勾选协议！','error');
		return false;
	}
	scope.post_json('jy_newnong/buyguoshu/notice/',scope.pagedata.post,function(result){
		scope.pagedata.order_id=result.order_id;
		scope.$evalAsync();
		scope.tool.pay(result.pay_id,function(res){
				if(res.type=='success'){
					scope.message('支付成功！','success','jy_newnong/myguoshu/');
				}else{
					scope.message('支付失败！','success','jy_newnong/order//type=guoshu_list');
				}
		},'','','jy_newnong/order//type=guoshu_list');
	});
}
</script>